package com.tianqu.tms.www.settle.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.google.common.base.Strings;
import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.www.settle.controller.TransferSettleReSettleController;

public class TransferSettleReSettleAction extends TmsAction {

	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {
		
		String insertUserId = "";
		if(Strings.isNullOrEmpty(request.getParameter("userid"))) {
			insertUserId = (String)uc.getAttribute("settleInsertUserId");
			uc.removeAttribute("settleInsertUserId");
		} else {
			insertUserId = request.getParameter("userid");
		}
		uc.setAttribute("settleInsertUserId", insertUserId);
		TransferSettleReSettleController controller = new TransferSettleReSettleController();
		controller.execute(uc);
		
		return mapping.findForward(TmsConstants.SUCCESS);
	}

}
